import { FilterConst } from "../../../component/gconst/FilterConst";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { TweenMax } from "../../../../com/greensock/TweenMax";
type int = number;
//class TipsItem
    
    export  class TipsItem /* flash.display.Sprite */
    {
        constructor()
        {
            
            mouseEnabled = false;
            mouseChildren = false;
            this._tipTxt = new Object /* flash.text.TextField */();
            this._tipTxt.multiline = true;
            this._tipTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._tipTxt.wordWrap = true;
            this._tipTxt.width = 150;
            this._tipTxt.selectable = false;
            this._tipTxt.mouseEnabled = false;
            this._tipTxt.textColor = 15263976;
            this._tipTxt.filters = [FilterConst.nameGlowFilter];
            addChild(this._tipTxt);
            return;
        }

        public get hideAble(): Boolean
        {
            return this._hideAble;
        }

        public get colorUpdated(): Boolean
        {
            return this._colorUpdated;
        }

        /* internal  */onTimerOut(): void
        {
            this._hideAble = false;
            if (this._hideFun != null) 
            {
                this._hideFun.call(this, this);
            }
            return;
        }

        public updateData(arg1: string, arg2: string="#ffff00", arg3: int=0, arg4: Function=null): void
        {
            this._colorUpdated = false;
            this._tipTxt.htmlText = HTMLUtil.addColor(arg1, arg2);
            this._hideAble = !(arg3 == 0);
            if (this.hideAble) 
            {
                this._timerKey = flash.utils.setTimeout(this.onTimerOut, arg3);
            }
            return;
        }

        public updateColor(arg1: string="#e8e8e8"): void
        {
            var loc1=HTMLUtil.removeHtml(this._tipTxt.htmlText);
            this._tipTxt.text = loc1;
            this._colorUpdated = true;
            return;
        }

        public easeIn(): void
        {
            this._tipTxt.y = 15;
            this._easeIn = TweenMax.to(this._tipTxt, 0.5, {"y": 0, "onComplete": this.onEaseInEnd});
            return;
        }

        public killEaseIn(): void
        {
            this._tipTxt.y = 0;
            if (this._easeIn && this._easeIn.active) 
            {
                this._easeIn.kill();
            }
            return;
        }

        /* internal  */onEaseInEnd(): void
        {
            return;
        }

        public dispose(): void
        {
            this.killEaseIn();
            this._colorUpdated = false;
            this._hideAble = false;
            this._hideFun = null;
            flash.utils.clearTimeout(this._timerKey);
            return;
        }

        public /* override */ get height(): number
        {
            if (this._tipTxt.textHeight > 50) 
            {
                return 15;
            }
            return this._tipTxt.textHeight;
        }

        /* internal */ /* var */_tipTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_timerKey: uint;

        /* internal */ /* var */_hideFun: Function;

        /* internal */ /* var */_hideAble: Boolean;

        /* internal */ /* var */_colorUpdated: Boolean;

        /* internal */ /* var */_easeIn: TweenMax;
    }
